package cn.com.nes.site.controller.product;

import cn.com.nes.site.entity.PageData;
import cn.com.nes.site.entity.vo.product.DelProductSeriesAndEnergyVO;
import cn.com.nes.site.entity.vo.product.QueryProductSeriesAndEnergyPageVO;
import cn.com.nes.site.entity.vo.product.SaveProductSeriesAndEnergyVO;
import cn.com.nes.site.service.product.ProductSeriesAndEnergyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * 产品系列 & 能源类型
 *
 * @Author: ShenWei
 * @Date: 2024/03/26/16:09
 */
@Api(tags = {"产品管理-类目管理"})
@Controller
@RequestMapping("/v2/product/category")
public class ProductSeriesAndEnergyController {

    @Resource
    ProductSeriesAndEnergyService productSeriesAndEnergyService;

    @ApiOperation("保存产品系列 & 能源类型")
    @RequestMapping(value = "/addProductSeriesAndEnergy", method = RequestMethod.POST)
    @ResponseBody
    public PageData saveProductSeriesAndEnergy(@RequestBody @Validated SaveProductSeriesAndEnergyVO vo) {
        return productSeriesAndEnergyService.saveProductSeriesAndEnergy(vo);
    }

    @ApiOperation("删除产品系列 & 能源类型")
    @RequestMapping(value = "/delProductSeriesAndEnergy", method = RequestMethod.POST)
    @ResponseBody
    public PageData delProductSeriesAndEnergy(@RequestBody DelProductSeriesAndEnergyVO vo) {
        return productSeriesAndEnergyService.delProductSeriesAndEnergy(vo);
    }

    @ApiOperation("查询产品系列 & 能源分类 - 树结构")
    @RequestMapping(value = "/getProductSeriesAndEnergy", method = RequestMethod.GET)
    @ResponseBody
    public PageData getProductSeriesAndEnergyTree(QueryProductSeriesAndEnergyPageVO vo) throws Exception {
        return productSeriesAndEnergyService.getProductSeriesAndEnergyTree(vo);
    }
}
